package com.itheima.util;

import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;

import java.io.IOException;

/**
 * 版权：(C) 版权所有 2000-2020 上海天好电子商务有限公司苏州分公司
 * <简述> track和storge
 * <详细描述>
 *
 * @author LiuShanshan
 * @version $Id$
 */
public class StorageClientUtil {

    /**
     *<简述>   获取tracker服务端
     *<详细描述>
     * @author Liushanshan
     * @param
     * @return org.csource.fastdfs.TrackerServer
    */
    public static TrackerServer getTrackServer() throws IOException {
        //创建TrackerClient对象
        TrackerClient trackerClient = new TrackerClient();
        //通过TrackerClient获取TrackerServer对象
        TrackerServer trackerServer = trackerClient.getConnection();
        return trackerServer;
    }

    /**
     *<简述>  获取StorageClient
     *<详细描述>
     * @author Liushanshan
     * @param
     * @return org.csource.fastdfs.StorageClient
    */
    public static StorageClient init() throws IOException {
        TrackerServer trackServer = getTrackServer();
        //通过TrackerServer创建StorageClient
        return  new StorageClient(trackServer,null);
    }



}
